package com.zj.study.utils.validation.validator.decimalmax;


import com.zj.study.utils.validation.annotation.ValidateSupport;
import com.zj.study.utils.validation.annotation.constraint.DecimalMax;
import java.math.BigDecimal;
import org.springframework.lang.NonNull;

/**
 * @author 谭耀飞
 * @since 2020.12.0
 */
@ValidateSupport(BigDecimal.class)
public class DecimalMaxValidatorForBigDecimal extends
    AbstractDecimalMaxValidator<BigDecimal> {

  @Override
  boolean compare(@NonNull DecimalMax decimalMax, @NonNull BigDecimal value) {
    return value.compareTo(new BigDecimal(decimalMax.value())) <= 0;
  }

}
